﻿@model WineStore.Models.News
@{
    ViewBag.Title = "CreateNews";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
}
<!-- Table (TABLE) -->
@section Styles
{
    <style type="text/css">
        input, textarea, select {
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 3px;
            color: #333;
            box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
            -moz-box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
            -webkit-box-shadow: rgba(0,0,0,0.1)0px 0px 8px;
            margin: 5px;
        }

            textarea {
               
                line-height: 18px;
                border-radius: 3px;
                margin: 5px;
            }


            input:hover, textarea:hover, select:hover input:focus, textarea:focus, select:focus {
                border-color: 10px solid #C9C9C9;
                box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                -moz-box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                -webkit-box-shadow: rgba(0,0,0,0.2)0px 0px 8px;
                border-radius: 3px;
            }

            input .submit {
                height: 38px;
                background-color: #474E69;
                color: #FFF;
                border-radius: 3px;
                -moz-border-radius: 3px;
                -webkit-border-radius: 3px;
                margin: 5px;
            }

        .text-box-con {
            width: 100%;
        }
    </style>
}
@section Scripts{
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/ckeditor/ckeditor.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/ckeditor/adapters/jquery.js")" type="text/javascript"></script>

}
@if (Session["Admin"] != null)
{
    <h3 class="tit">Thêm tin tức
    </h3>
    <fieldset>
        <legend>Thêm tin tức</legend>
        @using (Html.BeginForm("CreateNews", "News", FormMethod.Post, new { enctype = "multipart/form-data" }))
        { 
            @Html.ValidationSummary(true)
            <table class="nostyle">
                <tbody>
                    <tr>
                        <td>Danh mục tin tức <span style="color: Red">(*)</span>
                        </td>
                        <td style="color: Red;">
                            @Html.DropDownListFor(model => model.CategoryNewsId, null, "-- Loại tin tức--", new { style = "width:225px;" })
                            @Html.ValidationMessageFor(model => model.CategoryNewsId)
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: middle">Tiêu đề <span style="color: Red">(*)</span>
                        </td>
                        <td style="color: Red;">
                            @Html.TextAreaFor(model => model.NewsTitle_VN, 5, 100, null)
                            @Html.ValidationMessageFor(model => model.NewsTitle_VN)
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: middle">Mô tả <span style="color: Red">(*)</span>
                        </td>
                        <td style="color: Red;">
                            @Html.TextAreaFor(model => model.NewsDescription_VN, 10, 100, null)
                            @Html.ValidationMessageFor(model => model.NewsDescription_VN)
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: middle">Nội dung <span style="color: Red">(*)</span>
                        </td>
                        <td>
                            @Html.TextAreaFor(model => model.NewsContent_VN, new { @id = "ckNewsContent_VN"})
                            <script type="text/javascript">
                                CKEDITOR.replace("ckNewsContent_VN");
                            </script>
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: middle;">Ảnh(70*75) <span style="color: Red">(*)</span>
                        </td>
                        <td style="color: Red;">
                            @Html.TextBoxFor(model => model.NewsImage, new { type = "file" })
                            @Html.ValidationMessageFor(model => model.NewsImage)
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <input type="submit" value="Thêm tin tức" style="width: 100px; cursor: pointer;" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="9">
                            <b>Chú ý</b>: Những mục đánh dấu <span style="color: Red">(*)</span> là bắt buộc
                        </td>
                    </tr>
                </tbody>
            </table>
        }
    </fieldset>
}
else
{
    Response.Redirect("~/Admin/LogOn/");
}